import java.util.Arrays;
import java.util.concurrent.locks.Lock;
import java.util.concurrent.locks.ReadWriteLock;
import java.util.concurrent.locks.ReentrantReadWriteLock;

public class RWlock {

    public static void main(String[] args) {
        

        System.out.println("Rwlock.");
    }
}




class Co {
    private final  ReadWriteLock rwlock = new ReentrantReadWriteLock();
    private final  Lock rlock = rwlock.readLock();
    private final  Lock wlock = rwlock.writeLock();
    private int[] cost = new int[10];


    public void inc(int index){
        wlock.lock();
        try {
            cost[index] +=1;
        } catch (Exception e) {
            //TODO: handle exception
            wlock.unlock();
        }
    }


    public int[] get(){
        rlock.lock();
        try {
            return Arrays.copyOf(cost, cost.length);
        } catch (Exception e) {
            //TODO: handle exception
            rlock.unlock();
        }
        return new int[0];
    }

}